package com.wn.equipment.service.imp;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.wn.common.PageBean;
import com.wn.entity.Feedback;
import com.wn.entity.Hr;
import com.wn.entity.PersonalDetails;
import com.wn.equipment.mapper.PersonalDetailsMapper;
import com.wn.equipment.service.PersonalDetailsService;
import com.wn.equipment.vo.HrVo;
import com.wn.utils.PageBeanUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author zhairenhao
 * @date 2022/10/21 15:18
 */
@Service
@Slf4j
public class PersonalDetailsServiceImp implements PersonalDetailsService {

    @Autowired
    PersonalDetailsMapper personalDetailsMapper;

    @Override
    public List<PersonalDetails> getByUserId(int id) {
        return personalDetailsMapper.getByUserId(id);
    }

    @Override
    public void updateTel(PersonalDetails personalDetails) {
        personalDetailsMapper.updateTel(personalDetails);
    }

    @Override
    public void updatePassword(PersonalDetails personalDetails) {
        personalDetailsMapper.updatePassword(personalDetails);
    }

    @Override
    public PageBean<Hr> getEquipmentByPages(HrVo hrVo) {
        Page<Hr> page = PageHelper.startPage(hrVo.getCurrPage(), hrVo.getPageSize());
        List<Hr> list = personalDetailsMapper.getByCondition(hrVo.getHr());
        PageBean<Hr> pageBean = PageBeanUtil.getPageBean(list, page, hrVo.getCurrPage(), hrVo.getPageSize());
        return pageBean;
    }

}
